const express=require('express');
const server = require('express')();
server.use(express.static('dist'));
var proxy = require('http-proxy-middleware');

server.use('/api',proxy({
    target:'http://127.0.0.1:8081',
    changeOrigin: true,
    pathRewrite: {
        '^/api':'/api'
    },onProxyReq:function(proxyReq, req, res){
        console.log(req.url,req.body);
        //proxyReq.setHeader('access_token', req.session.user ? req.session.user.token:'' );
    }
}))

server.listen(8082)